<?php

use yii\helpers\Html;
use common\entities\cms\DirEntity;
?>
<div ng-view="" class="ng-scope">
    <div data-ng-controller="contractDredgeCtrl" class="ng-scope">
        <div class="table-header clearfix ng-scope">
            <span class="fl lh30 f14 ng-binding">目录编辑</span>
        </div>
        <?php if ($model->hasErrors()) echo Html::errorSummary($model, ['class' => 'errorSummary']); ?>
        <?php echo Html::beginForm($model->getIsNewRecord() ? [''] : ['', 'id' => $model->getPrimaryKey()], 'post', ['enctype' => 'multipart/form-data', 'autocomplete' => 'off', 'class' => 'form-horizontal ng-pristine ng-valid']); ?>
        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'parent_id'); ?>
            </span>
            <div class="col-sm-5">
                <?php echo Html::activeDropDownList($model, 'parent_id', [0 => '顶级目录'] + DirEntity::getOptions(), ['class' => 'form-control']); ?>
            </div>
        </div>

        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'code'); ?>
            </span>
            <div class="col-sm-4">
                <?php echo Html::activeDropDownList($model, 'code', DirEntity::getEnumOption(), ['class' => 'form-control', 'prompt' => '']); ?>
                <span class="error c-redlh30">非专业人士，请勿随意修改</span>
            </div>
        </div>

        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'name'); ?>
            </span>
            <div class="col-sm-7">
                <?php echo Html::activeTextInput($model, 'name', ['class' => 'form-control']); ?>
            </div>
        </div>

        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'short_desc'); ?>
            </span>
            <div class="col-sm-11">
                <?php echo Html::activeTextInput($model, 'short_desc', ['class' => 'form-control']); ?>
            </div>
        </div>

        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'img_url'); ?>
            </span>
            <div class="col-sm-11">
                <?php echo Html::activeTextInput($model, 'img_url', ['class' => 'form-control']); ?>
            </div>
        </div>

        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'url'); ?>
            </span>
            <div class="col-sm-11">
                <?php echo Html::activeTextInput($model, 'url', ['class' => 'form-control']); ?>
            </div>
        </div>

        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'sort'); ?>
            </span>
            <div class="col-sm-2">
                <?php echo Html::activeTextInput($model, 'sort', ['class' => 'form-control']); ?>
            </div>
        </div>
        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'status'); ?>
            </span>
            <div class="col-sm-2">
                <?php echo Html::activeCheckbox($model, 'status', ['label' => '']); ?>
            </div>
        </div>
        
        <div class="form-group mt10">
            <span class="col-sm-3 control-label ml15">
                <?php echo Html::activeLabel($model, 'external_display'); ?>
            </span>
            <div class="col-sm-2">
                <?php echo Html::activeCheckbox($model, 'external_display', ['label' => '']); ?>
            </div>
        </div>
        <div class="form-group">
            <div class="ml35 mt15">
                <?php echo Html::submitButton('保存', ['class' => 'btn btn-default ng-scope']); ?>
                <?php echo Html::a('返回列表', '?r=/cms/dir/index', ['class' => 'btn btn-yellow']); ?>
            </div>
        </div>
        <?php echo Html::endForm(); ?>
    </div>
</div>